package org.example;

import org.springframework.stereotype.Component;

@Component
public class PaymentService {

    //限流方法的注解 要标明限流器 和 降级回退方法的名字
    @UseRateLimiter(name = MyRateLimiterConstant.TOKEN_BUCKET_RATE_LIMITER, fallbackMethod = "fallbackPayment")
    public int myProcessPayment( ) {
        System.out.println("正常处理");
        return 1;
    }

    //回退降级方法
    public int fallbackPayment() {
        System.out.println("降级处理");
        return 0;
    }

}
